﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>增加对象引用计数 / 减少对象引用计数 - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The 增加对象引用计数 and 减少对象引用计数 functions increment or decrement an 对象's reference count." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>


<h1>增加对象引用计数 / 减少对象引用计数</h1>

<p>增加或减少对象的<a href="../Objects.htm#Reference_Counting">引用计数</a>.</p>

<pre class="Syntax">NewRefCount := <span class="func">增加对象引用计数</span>(Ptr)
NewRefCount := <span class="func">减少对象引用计数</span>(Ptr)</pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>Ptr</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#numbers">整数</a></p>
    <p>非托管对象指针或 COM 接口指针.</p>
  </dd>

</dl>

<h2 id="Return_Value">返回值</h2>
<p>类型: <a href="../Concepts.htm#numbers">整数</a></p>
<p>这两个函数返回新的引用计数. 该值应该 <b>仅</b> 用于调试.</p>

<h2 id="Related">相关</h2>
<p><a href="../Objects.htm#Reference_Counting">引用计数</a></p>
<p>尽管后面列出的文章讨论了适用于 COM 的引用计数, 但其中也包含了通常也适用于 AutoHotkey 对象的重要概念和规则: <a href="http://msdn.microsoft.com/en-us/library/ms691379.aspx">IUnknown::AddRef</a>, <a href="http://msdn.microsoft.com/en-us/library/ms682317.aspx">IUnknown::Release</a>, <a href="https://msdn.microsoft.com/en-us/library/ms692481.aspx">引用计数规则</a>.</p>

</body>
</html>